package de.jmda.gen.java;

import static de.jmda.core.util.StringUtil.sb;

import javax.validation.constraints.NotNull;

import de.jmda.gen.Generator;
import de.jmda.gen.GeneratorException;
import de.jmda.gen.LineIndenter;

/**
 * Generates type kind specifiers 'interface', 'class', 'enum', or 'annotation'.
 *
 * @author roger.jmda@gmail.com
 */
public enum TypeKindGenerator implements Generator
{
	CLASS("class"),
	INTERFACE("interface"),
	ENUM("enum"),
	ANNOTATION("@interface")
	;

	private StringBuffer typeKind;

	private LineIndenter lineIndenter;

	private TypeKindGenerator(String typeKind)
	{
		this.typeKind = sb(typeKind);
	}

	@Override
  public void setLineIndenter(@NotNull LineIndenter lineIndenter)
  {
		this.lineIndenter = lineIndenter;
  }

	@Override
  @NotNull
  public LineIndenter getLineIndenter()
  {
	  return lineIndenter;
  }

	@Override
  public StringBuffer generate() throws GeneratorException
  {
	  return typeKind;
  }

	public String getTypeKind()
	{
		return typeKind.toString();
	}
}